/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ads.similar;

import ads.graph.Graph;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author frama_000
 */
public class WordToolBox {
    public static ArrayList<String> getWordsFromFile(String fileName){
        FileInputStream fstream = null;
        try {
            fstream = new FileInputStream(fileName);
            // Get the object of DataInputStream
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            Graph graph = new Graph();
            //Read File Line By Line
            ArrayList<String> lines = new ArrayList<>();
            try {
                while ((strLine = br.readLine()) != null) {
                    lines.add(strLine);
                }
            } catch (IOException ex) {
                Logger.getLogger(WordToolBox.class.getName()).log(Level.SEVERE, null, ex);
            }
            return lines;
        } catch (FileNotFoundException ex) {
            Logger.getLogger(WordToolBox.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                fstream.close();
            } catch (IOException ex) {
                Logger.getLogger(WordToolBox.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        return null;
    }
}
